import 'package:common/common.dart';
import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:miaowu/app/common/window_pop/public_btn_tem.dart';
import 'package:miaowu/app/common/window_pop/public_btn_widget.dart';

class MemberAgreementWidget extends StatelessWidget {
  const MemberAgreementWidget({
    super.key,
    this.isChecked = false,
    required this.onChecked,
    required this.config,
    required this.title,
  });

  final PublicBtnItem config;
  final String title;

  final bool isChecked;
  final Function onChecked;

  @override
  Widget build(BuildContext context) {
    return Container(
      margin: const EdgeInsets.symmetric(vertical: 22),
      child: Row(
        mainAxisAlignment: MainAxisAlignment.start,
        crossAxisAlignment: CrossAxisAlignment.start,
        children: [
          Padding(
            padding: const EdgeInsets.only(top: 2),
            child: Image.asset(
                    isChecked
                        ? 'assets/app/images/member/member_check_s.png'
                        : 'assets/app/images/member/member_check_n.png',
                    width: 15.0.w)
                .onTap(() {
              onChecked.call();
            }),
          ),
          Expanded(
            child: Padding(
              padding: const EdgeInsets.only(left: 10, right: 10),
              child: RichText(
                  maxLines: 3,
                  text: TextSpan(children: [
                    TextSpan(text: title, style: TextStyle(color: const Color(0xFF999999), fontSize: 12.sp)),
                    TextSpan(
                        text: ' ${config.title}',
                        style: TextStyle(color: const Color(0xFF25D4D0), fontSize: 12.sp),
                        recognizer: TapGestureRecognizer()
                          ..onTap = () {
                            publicCheckClickAction(
                                btnItem: config,
                                alertCallBack: (WindowBtn item) {},
                                clickAction: (PublicBtnItem btnItem) {});
                            // GlobalWebPage.startInstance(link1.title ?? '', link1.click!.jump ?? '');
                          }),
                  ])),
            ),
          ),
        ],
      ),
    );
  }
}
